<!DOCTYPE html>
<html lang="en">
<head>
	<meta charset="UTF-8">
	<title>实现交换数组中两个元素的功能</title>
	<script>
		var arr=[1,2,3,4];
		function getposition(arr,index1,index2){
         num=arr[index1];
         arr[index1]=arr[index2];
         arr[index2]=num;
         console.log(arr);
		}
		getposition(arr,0,3);
	
	</script>
</head>
<body>
	
</body>
</html>